#include <iostream>
using std::cout;
using std::endl;

void test0(){
    int a = 10, b = 20, c = 30;
    
    // 指针数组：包含3个int指针的数组
    int* ptrArr[3] = {&a, &b, &c};
    
    cout << "指针数组示例：" << endl;
    for(int i = 0; i < 3; i++) {
        cout << "ptrArr[" << i << "] = " << ptrArr[i] 
             << ", *ptrArr[" << i << "] = " << *ptrArr[i] << endl;
    }
}

void test1(){
    int arr[3] = {10, 20, 30};
    
    // 数组指针：指向包含3个int的数组的指针
    int (*arrPtr)[3] = &arr;
    
    cout << "数组指针示例：" << endl;
    cout << "arrPtr = " << arrPtr << ", *arrPtr = " << *arrPtr << endl;
    
    for(int i = 0; i < 3; i++) {
        cout << "(*arrPtr)[" << i << "] = " << (*arrPtr)[i] << endl;
    }
}

int main(void){
    // test0();
    test1();
    return 0;
}

